<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>My Project: drogon::Attributes类 参考</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">My Project
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.9.8 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','搜索');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">载入中...</div>
<div class="SRStatus" id="Searching">搜索中...</div>
<div class="SRStatus" id="NoMatches">未找到</div>
</div>
</div>
</div>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespacedrogon.html">drogon</a></li><li class="navelem"><a class="el" href="classdrogon_1_1Attributes.html">Attributes</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public 成员函数</a> &#124;
<a href="classdrogon_1_1Attributes-members.html">所有成员列表</a>  </div>
  <div class="headertitle"><div class="title">drogon::Attributes类 参考</div></div>
</div><!--header-->
<div class="contents">

<p>This class represents the attributes stored in the HTTP request. One can add/get any type of data to/from an <a class="el" href="classdrogon_1_1Attributes.html" title="This class represents the attributes stored in the HTTP request. One can add/get any type of data to/...">Attributes</a> object.  
 <a href="classdrogon_1_1Attributes.html#details">更多...</a></p>

<p><code>#include &lt;<a class="el" href="Attribute_8h_source.html">Attribute.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
Public 成员函数</h2></td></tr>
<tr class="memitem:a6dcc0c4c9a7f553573930996f5f65199" id="r_a6dcc0c4c9a7f553573930996f5f65199"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr>
<tr class="memitem:a6dcc0c4c9a7f553573930996f5f65199"><td class="memTemplItemLeft" align="right" valign="top">const T &amp;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classdrogon_1_1Attributes.html#a6dcc0c4c9a7f553573930996f5f65199">get</a> (const std::string &amp;key) const</td></tr>
<tr class="memdesc:a6dcc0c4c9a7f553573930996f5f65199"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the data identified by the key parameter.  <br /></td></tr>
<tr class="separator:a6dcc0c4c9a7f553573930996f5f65199"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:addd406636d707ec1e6c7502a36acf1b4" id="r_addd406636d707ec1e6c7502a36acf1b4"><td class="memItemLeft" align="right" valign="top">std::any &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classdrogon_1_1Attributes.html#addd406636d707ec1e6c7502a36acf1b4">operator[]</a> (const std::string &amp;key)</td></tr>
<tr class="memdesc:addd406636d707ec1e6c7502a36acf1b4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the 'any' object identified by the given key  <br /></td></tr>
<tr class="separator:addd406636d707ec1e6c7502a36acf1b4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abb8720e9901aa00ee76039e5579d30fd" id="r_abb8720e9901aa00ee76039e5579d30fd"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classdrogon_1_1Attributes.html#abb8720e9901aa00ee76039e5579d30fd">insert</a> (const std::string &amp;key, const std::any &amp;obj)</td></tr>
<tr class="memdesc:abb8720e9901aa00ee76039e5579d30fd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Insert a key-value pair  <br /></td></tr>
<tr class="separator:abb8720e9901aa00ee76039e5579d30fd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aac8fc549203b5793323e7c369faa32a4" id="r_aac8fc549203b5793323e7c369faa32a4"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classdrogon_1_1Attributes.html#aac8fc549203b5793323e7c369faa32a4">insert</a> (const std::string &amp;key, std::any &amp;&amp;obj)</td></tr>
<tr class="memdesc:aac8fc549203b5793323e7c369faa32a4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Insert a key-value pair  <br /></td></tr>
<tr class="separator:aac8fc549203b5793323e7c369faa32a4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af9e4dfe40a13d168c02e152e3b6c17f0" id="r_af9e4dfe40a13d168c02e152e3b6c17f0"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classdrogon_1_1Attributes.html#af9e4dfe40a13d168c02e152e3b6c17f0">erase</a> (const std::string &amp;key)</td></tr>
<tr class="memdesc:af9e4dfe40a13d168c02e152e3b6c17f0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Erase the data identified by the given key.  <br /></td></tr>
<tr class="separator:af9e4dfe40a13d168c02e152e3b6c17f0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a927e9840c091578cf8caf8b60b1e6821" id="r_a927e9840c091578cf8caf8b60b1e6821"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classdrogon_1_1Attributes.html#a927e9840c091578cf8caf8b60b1e6821">find</a> (const std::string &amp;key)</td></tr>
<tr class="memdesc:a927e9840c091578cf8caf8b60b1e6821"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return true if the data identified by the key exists.  <br /></td></tr>
<tr class="separator:a927e9840c091578cf8caf8b60b1e6821"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a84f04a61bd7febcb39ee82be493a5d97" id="r_a84f04a61bd7febcb39ee82be493a5d97"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classdrogon_1_1Attributes.html#a84f04a61bd7febcb39ee82be493a5d97">clear</a> ()</td></tr>
<tr class="memdesc:a84f04a61bd7febcb39ee82be493a5d97"><td class="mdescLeft">&#160;</td><td class="mdescRight">Clear all attributes.  <br /></td></tr>
<tr class="separator:a84f04a61bd7febcb39ee82be493a5d97"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac26fe2f99092c7cd16a72633e5b68ced" id="r_ac26fe2f99092c7cd16a72633e5b68ced"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classdrogon_1_1Attributes.html#ac26fe2f99092c7cd16a72633e5b68ced">Attributes</a> ()=default</td></tr>
<tr class="memdesc:ac26fe2f99092c7cd16a72633e5b68ced"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructor, usually called by the framework  <br /></td></tr>
<tr class="separator:ac26fe2f99092c7cd16a72633e5b68ced"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">详细描述</h2>
<div class="textblock"><p>This class represents the attributes stored in the HTTP request. One can add/get any type of data to/from an <a class="el" href="classdrogon_1_1Attributes.html" title="This class represents the attributes stored in the HTTP request. One can add/get any type of data to/...">Attributes</a> object. </p>
</div><h2 class="groupheader">构造及析构函数说明</h2>
<a id="ac26fe2f99092c7cd16a72633e5b68ced" name="ac26fe2f99092c7cd16a72633e5b68ced"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac26fe2f99092c7cd16a72633e5b68ced">&#9670;&#160;</a></span>Attributes()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">drogon::Attributes::Attributes </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">default</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Constructor, usually called by the framework </p>

</div>
</div>
<h2 class="groupheader">成员函数说明</h2>
<a id="a84f04a61bd7febcb39ee82be493a5d97" name="a84f04a61bd7febcb39ee82be493a5d97"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a84f04a61bd7febcb39ee82be493a5d97">&#9670;&#160;</a></span>clear()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void drogon::Attributes::clear </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Clear all attributes. </p>

</div>
</div>
<a id="af9e4dfe40a13d168c02e152e3b6c17f0" name="af9e4dfe40a13d168c02e152e3b6c17f0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af9e4dfe40a13d168c02e152e3b6c17f0">&#9670;&#160;</a></span>erase()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void drogon::Attributes::erase </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>key</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Erase the data identified by the given key. </p>

</div>
</div>
<a id="a927e9840c091578cf8caf8b60b1e6821" name="a927e9840c091578cf8caf8b60b1e6821"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a927e9840c091578cf8caf8b60b1e6821">&#9670;&#160;</a></span>find()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool drogon::Attributes::find </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>key</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Return true if the data identified by the key exists. </p>

</div>
</div>
<a id="a6dcc0c4c9a7f553573930996f5f65199" name="a6dcc0c4c9a7f553573930996f5f65199"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6dcc0c4c9a7f553573930996f5f65199">&#9670;&#160;</a></span>get()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">const T &amp; drogon::Attributes::get </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>key</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Get the data identified by the key parameter. </p>
<dl class="section note"><dt>注解</dt><dd>if the data is not found, a default value is returned. For example: <div class="fragment"><div class="line"><span class="keyword">auto</span> &amp;userName = attributesPtr-&gt;get&lt;std::string&gt;(<span class="stringliteral">&quot;user name&quot;</span>);</div>
</div><!-- fragment --> </dd></dl>

</div>
</div>
<a id="abb8720e9901aa00ee76039e5579d30fd" name="abb8720e9901aa00ee76039e5579d30fd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abb8720e9901aa00ee76039e5579d30fd">&#9670;&#160;</a></span>insert() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void drogon::Attributes::insert </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::any &amp;&#160;</td>
          <td class="paramname"><em>obj</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Insert a key-value pair </p>
<dl class="section note"><dt>注解</dt><dd>here the any object can be created implicitly. for example <div class="fragment"><div class="line">attributesPtr-&gt;insert(<span class="stringliteral">&quot;user name&quot;</span>, userNameString);</div>
</div><!-- fragment --> </dd></dl>

</div>
</div>
<a id="aac8fc549203b5793323e7c369faa32a4" name="aac8fc549203b5793323e7c369faa32a4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aac8fc549203b5793323e7c369faa32a4">&#9670;&#160;</a></span>insert() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void drogon::Attributes::insert </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::any &amp;&amp;&#160;</td>
          <td class="paramname"><em>obj</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Insert a key-value pair </p>
<dl class="section note"><dt>注解</dt><dd>here the any object can be created implicitly. for example <div class="fragment"><div class="line">attributesPtr-&gt;insert(<span class="stringliteral">&quot;user name&quot;</span>, userNameString);</div>
</div><!-- fragment --> </dd></dl>

</div>
</div>
<a id="addd406636d707ec1e6c7502a36acf1b4" name="addd406636d707ec1e6c7502a36acf1b4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#addd406636d707ec1e6c7502a36acf1b4">&#9670;&#160;</a></span>operator[]()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">std::any &amp; drogon::Attributes::operator[] </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>key</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Get the 'any' object identified by the given key </p>

</div>
</div>
<hr/>该类的文档由以下文件生成:<ul>
<li><a class="el" href="Attribute_8h_source.html">Attribute.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.8
</small></address>
</body>
</html>
